﻿namespace Ymatou.UserAuth.Agent.Sso
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Web;

    public class SiteFilter
    {
        /// <summary>
        ///  检查来源站点是否在非法站点范围内。
        /// </summary>
        /// <param name="siteName">siteName</param>
        /// <returns>true，在非法站点内；false，不在非法站点内</returns>
        public static bool RequestInFilter(string siteName)
        {
            if (siteName.Contains("ymatou")) { return false; }
            return true;
        }
        /// <summary>
        ///  检查来源站点（请求）是否在非法站点范围内。
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static bool RequestInFilter(HttpRequest request)
        {
            if (request == null || request.UrlReferrer == null) return true;
            //TODO:加入其他过滤条件
            if (request.UrlReferrer.Host.Contains("ymatou")) { return false; }
            return true;
        }
    }
}
